#include <oatpp-websocket/ConnectionHandler.hpp>
#include <oatpp-websocket/WebSocket.hpp>
#include "RemoteHandle.h"
#include "Client.h"

class WSMonitor : public oatpp::websocket::WebSocket::Listener
{
private:
    std::mutex& m_writeMutex;
    oatpp::data::stream::BufferOutputStream m_messageBuffer;
    Client* _evtHandler;
    RemoteHandle* _remoteHandle;
public:
    WSMonitor(std::mutex& writeMutex,Client* evtHandler,RemoteHandle* remoteHandler);
    void onPing(const WebSocket& socket, const oatpp::String& message) override;
    void onPong(const WebSocket& socket, const oatpp::String& message) override;
    void onClose(const WebSocket& socket, v_uint16 code, const oatpp::String& message) override;
    void readMessage(const WebSocket& socket, v_uint8 opcode, p_char8 data, oatpp::v_io_size size) override;
};